<template>
      <header class="header black-bg">
        <div class="sidebar-toggle-box">
          <div class="fa fa-bars tooltips" data-placement="right" data-original-title="Toggle Navigation"></div>
        </div>
        <a @click="head" class="logo"><b>{{head_message}}<span>{{head_messageTow}}</span></b></a>
        <div class="nav notify-row" id="top_menu">
        </div>
        <div class="top-menu">
          <ul class="nav pull-right top-menu">
            <li><a class="logout"  @click="logout">{{logout_msg}}</a></li>
          </ul>
        </div>
      </header>
</template>

<script>
  export default {
    name: 'myhead',
    data () {
      return {
        logout_msg:"注销",
        head_message: '云归谷',
        head_messageTow:'远程控制系统',
      }
    },
    methods:{
      head(){
        
      },
      logout:function(){
        var that = this
        var token = sessionStorage.getItem('shiro-token')
        sessionStorage.clear();
        if (!token) {
          this.$router.push({path: '/'})
          return true
        }else{
          var instance = this.$axios.create({
            headers: {'Authorization':token}
          });
          instance.post('ganzi-server/user/mylogout')
          .then(function (response) {
              that.$router.push({path: '/'})
          })
          .catch(function (error) {
            that.$router.push({path: '/'})
          });
        }
      },
      showToast:function(msg){
          alert(msg);
      }
    }
  }
</script>

<style scoped>
  @import "../assets/css/jquery.gritter.css";
</style>
